package com.dongzili.easysearch.custom.entity;

import com.dongzili.easysearch.common.utils.IdUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.Settings;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;

@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Data
@Settings(maxResultWindow = 100000000, shardsNum = 3, replicasNum = 2)
@IndexName(value = "products")
public class Product {


    private String id;

    @IndexField(fieldType = FieldType.KEYWORD)
    private String mysqlId;

    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART)
    private String name;

    @IndexField(fieldType = FieldType.DOUBLE)
    private Double price;

    public Product(String s, double v) {
        this.mysqlId = IdUtils.getId();
        this.name = s;
        this.price = v;
    }
}